package com.azdebugit.java8.test.memory.metaspace;

import java.util.ArrayList;
import java.util.List;
// -XX:PermSize=8M  -XX:MaxPermSize=8m -Xmx16m
// -XX:MetaspaceSize=8m  -XX:MaxMetaspaceSize=8m
public class StringOomMock {
    static String  base = "string";
    public static void main(String[] args) {
        List<String> list = new ArrayList<String>();
        int i =0 ;
        try {
            for (i = 0; i < Integer.MAX_VALUE; i++) {
                String str = base + base;
                base = str;
                list.add(str.intern());
            }
        } finally {
            System.out.println("----" + i + "----：" + list.size());
        }
    }
}